﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Zero.POCO.Enum.Helper
{
    public static class Combinatorial
    {
        static Decimal GetCombinatorial(Decimal n,Decimal r)
        {
            Func<decimal, decimal> factorial = null;
            factorial = x => x <= 1 ? 1 : x * factorial(x - 1);

            var upper = factorial(n);
            var downFirst = factorial(n - r);
            var downSecond = factorial(r);


            return upper*(downFirst*downSecond);
        }
    }
    
   
}
